﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

public partial class main : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
        }
        else
        {
            TUser1.CheckUser(this);
            
            //设定状态
            if ((this.Session["ecrm_email"] == null) || (this.Session["ecrm_email"].ToString() == ""))
            {
                userstatus1.Text = "你好，请 <a href=\"main.aspx\">登录</a>或 ";
                userstatus2.Text = "<a href=\"./user/user_reg.aspx\">注册</a>";
            }
            else
            {
                string sid = this.Session["ecrm_uid"].ToString();
                TUser oUser = new TUser(sid);
                oUser.Select();
                string bigname = oUser.BigName;

                userstatus1.Text = "<a onclick='javascript:location.href=\"./user/user_myself.aspx\"' onmouseover='this.style.cursor=\"pointer\"' onmouseout='this.style.backgroundColor=\"\"'>" + bigname + "的设置</a>";
                userstatus2.Text = "<a onclick='javascript:location.href=\"./user/user_logout.aspx\"' onmouseover='this.style.cursor=\"pointer\"' onmouseout='this.style.backgroundColor=\"\"'>退出</a>";

                //username.Text = bigname;

                mynews.Text = "<a href=\"my_pubnews.aspx?myuid=" + sid + "\" target=_blank  style='font-weight: normal; font-size: 12px; color: black'>发布新公告</a>";

                string sSql = "";
                string cdate = DateTime.Today.ToString("yyyy-M-d");
                sSql = "select count(*) from vw_givelist where status=4 and giveedate>='" + cdate + "' and givemag like '%汽车画报%' and inman='" + sid + "'";
                int iQchb = TSqlDB.ExecuteScalar(sSql);
                sSql = "select count(*) from vw_givelist where status=4 and giveedate>='" + cdate + "' and givemag like '%动感驾驭%' and inman='" + sid + "'";
                int iDgjy = TSqlDB.ExecuteScalar(sSql);
                //myzmaglist.Text = "<a href=\"my_givelist03.aspx?myuid=" + sid + "\" target=_blank>当月赠刊名录("+((int)(iQchb+iDgjy)).ToString()+"人)</a>";
                

                //if (TCommon.sendmailusers.IndexOf(oUser.EMail) != -1)
                //{
                //    iwant01.InnerHtml = "&nbsp;&nbsp;·我要&gt;&gt;&nbsp;<span style=\"font-size:12pt\"><a href=\"./system/send_emailgroup.aspx\" target=\"_blank\">群组发邮件</a></span>";
                //}

                //if (TCommon.postusers.IndexOf(oUser.EMail) != -1)
                //{
                //    iwant02.InnerHtml = "&nbsp;&nbsp;·我要&gt;&gt;&nbsp;<span style=\"font-size:12pt\"><a href=\"./system/zmag_list.aspx\" target=\"_blank\">获得最新赠阅列表</a></span>";
                //}

            }

        }

    }
}
